package com.share.service.attach.advertise.impl;

import java.util.LinkedHashMap;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.share.bean.attach.advertise.PositionSort;
import com.share.dao.attach.advertise.PositionSortDao;
import com.share.service.attach.advertise.PositionSortManager;

@Service
public class PositionSortManagerImpl implements PositionSortManager{
	
	@Resource
	private PositionSortDao psd ;
	
	public void setPsd(PositionSortDao psd) {
		this.psd = psd;
	}

	@Override
	public void deletePositionSortManager(int id) throws Exception {
		this.psd.deletePositionSortDao(id) ;
	}

	@Override
	public List<PositionSort> findAllPositionSortManager()
			throws Exception {
		
		String hql = "select o from PositionSort o order by o.id desc" ;
		
		LinkedHashMap<String, String> orderby = new LinkedHashMap<String, String>() ;
		orderby.put("id", "asc") ;
		
		return this.psd.findAllPositionSortDao(hql, orderby) ;
	}

	@Override
	public PositionSort loadByIdPositionSortManager(int id)
			throws Exception {
		
		return this.psd.loadByIdPositionSortDao(id) ;
	}

	@Override
	public void savePositionSortManager(PositionSort ps)
			throws Exception {
		this.psd.savePositionSortDao(ps) ;
	}

	@Override
	public void updatePositionSortManager(PositionSort ps)
			throws Exception {
		this.psd.updatePositionSortDao(ps) ;
	}

}
